﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="new.aspx.cs" Inherits="AnyOffice.general.mobile._new" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>手机短信</title>
		<link rel="stylesheet" type="text/css" href="/module/date_selector/popcalendar.css">
		<script src="/module/date_selector/popcalendar.js"></script>
		<script src="/aspnet_client/core/function.js"></script>
		<script Language="JavaScript">
function CheckForm()
{
   if(document.Form1.ToId.value=="" && IsNullMobile())
   { alert("请添加收信人！");
     return (false);
   }

   if(document.Form1.txtContent.value=="")
   { alert("短信内容不能为空！");
     return (false);
   }
   
   if(!checkIsDateTime(document.Form1.txtSendTime.value) || document.Form1.txtSendTime.value == "")
   {
	 alert("发送时间不正确！");
	 return (false);
   }
   return (true);
}

function IsNullMobile()
{
	if(document.getElementById("txtMobile") != null)
	{
		if(document.getElementById("txtMobile").value == "")
			return true;
		else
			return false;
	}
	else
		return true;
}

function CheckSend()
{
  if(event.keyCode==10)
  {
    if(CheckForm())
       document.Form1.submit();
  }
}

 var cap_max=140;
 function getLeftChars(varField)
 {
    var i = 0;
    var counter = 0;
    var cap = cap_max;
    var leftchars = cap - varField.value.length;

    return (leftchars);
 }

 function onCharsChange(varField)
 {
     var leftChars = getLeftChars(varField);
     if ( leftChars >= 0)
     {
 		document.Form1.charsmonitor1.value=cap_max-leftChars;
 		document.Form1.charsmonitor2.value=leftChars;
 		return true;
     }
     else
     {
     	document.Form1.charsmonitor1.value=cap_max;
     	document.Form1.charsmonitor2.value="0";
     	window.alert("短信内容超过字数限制！");
     	var len = document.Form1.txtContent.value.length + leftChars;
 		document.Form1.txtContent.value = document.Form1.txtContent.value.substring(0, len);
 		leftChars = getLeftChars(document.Form1.txtContent);
     	if ( leftChars >= 0)
     	{
 			document.Form1.charsmonitor1.value=cap_max-leftChars;
 			document.Form1.charsmonitor2.value=leftChars;
		}
        return false;
     }
 }

function LoadDo()
{
  SignName();
}

function SignName()
{
  document.Form1.txtContent.value+="<%=ViewState["UserName"]%>:";
  onCharsChange(document.Form1.txtContent);
  document.Form1.txtContent.focus();
}

function ClearContent()
{
  document.Form1.txtContent.value="";
  onCharsChange(document.Form1.txtContent);
  document.Form1.txtContent.focus();
}

function notice()
{
   msg="注意：\n\n所发送的手机短信将在本系统中进行记录，\n请勿发送与工作无关的涉及个人隐私的信息，\n请提醒接收方：其直接回复的信息也可能导致隐私泄露。";
   alert(msg);	
}

		</script>
	</HEAD>
	<body class="bodycolor" topmargin="5">
		<form id="Form1" method="post" runat="server">
			<asp:Panel id="pnlMain" runat="server">
				<TABLE class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
					<TR>
						<TD class="Big"><IMG height="20" src="/images/menu/mobile.gif" width="20" align="absMiddle"><SPAN class="big3">
								发送手机短信
								<asp:Literal id="litNavTitel" runat="server"></asp:Literal></SPAN></TD>
					</TR>
				</TABLE>
				<TABLE class="small" cellSpacing="1" cellPadding="3" width="500" align="center" bgColor="#000000"
					border="0">
					<TR>
						<TD class="TableData" noWrap>收信人[内部用户]：</TD>
						<TD class="TableData" noWrap><TEXTAREA class="BigStatic" id="ToName" name="ToName" rows="3" readOnly wrap="yes" cols="40"
								runat="server"></TEXTAREA> &nbsp;<INPUT class="SmallButton" title="添加收信人" onclick="user_select('ToId','ToName')" type="button"
								value="添 加" name="button"> &nbsp;<INPUT class="SmallButton" title="清空收信人" onclick="clear_double('ToId','ToName')" type="button"
								value="清 空" name="button"> <INPUT id="ToId" type="hidden" name="ToId" runat="server">
						</TD>
					</TR>
					<asp:Panel id="pnlMobile" runat="server">
						<TR>
							<TD class="TableData" noWrap>收信人[外部号码]：</TD>
							<TD class="TableData">号码之间请用逗号分隔或每行一条 <TEXTAREA class="BigInput" id="txtMobile" name="txtMobile" rows="3" wrap="yes" cols="40" runat="server"></TEXTAREA>
							</TD>
						</TR>
					</asp:Panel>
					<TR>
						<TD class="TableData" noWrap>短信内容：</TD>
						<TD class="TableData">已输入 <INPUT class="SmallStatic" readOnly type="text" size="3" name="charsmonitor1">
							字符，剩余 <INPUT class="SmallStatic" readOnly type="text" size="3" name="charsmonitor2">
							字符，每条70字，超出部份转第2条<BR>
							<BR>
							<TEXTAREA class="BigInput" onkeypress="CheckSend()" onpaste="return onCharsChange(this);"
								id="txtContent" onkeyup="return onCharsChange(this);" name="txtContent" rows="5" wrap="on"
								cols="40" runat="server"></TEXTAREA><BR>
							<A href="javascript:notice();">隐私警示</A>
						</TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap>发送时间：</TD>
						<TD class="TableData"><INPUT class="BigInput" id="txtSendTime" type="text" maxLength="20" size="20" name="txtSendTime"
								runat="server"><IMG style="CURSOR: hand" onclick="popUpCalendar(this,txtSendTime,'yyyy-mm-dd','');"
								src="/module/date_selector/calendar.gif" align="absMiddle" border="0"> <IMG style="CURSOR: hand" onclick="popClock('txtSendTime');" src="/images/menu/clock.gif"
								align="absMiddle" border="0">
						</TD>
					</TR>
					<TR class="TableControl" align="center">
						<TD noWrap colSpan="2"><INPUT class="BigButton" onclick="return CheckForm();" type="submit" value="发送">&nbsp;&nbsp;&nbsp;&nbsp;
							<INPUT class="BigButton" onclick="SignName()" type="button" value="签名">&nbsp;&nbsp;&nbsp;&nbsp;
							<INPUT class="BigButton" onclick="ClearContent()" type="button" value="清空内容">
						</TD>
					</TR>
				</TABLE>
				<SCRIPT language="javascript">
				 LoadDo();
				</SCRIPT>
			</asp:Panel>
			<asp:Panel id="pnlLater" runat="server" Visible="False">
				<TABLE class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
					<TR>
						<TD class="Big"><IMG height="20" src="/images/menu/mobile.gif" width="22" align="absMiddle"><SPAN class="big3">
								手机短信发送情况</SPAN>
						</TD>
					</TR>
				</TABLE>
				<asp:Literal id="litNoMobile" runat="server"></asp:Literal>
				<asp:Literal id="litMobileError" runat="server"></asp:Literal>
				<asp:Literal id="litMessage" runat="server"></asp:Literal>
				<DIV align="center">
					<INPUT class="BigButton" onclick="location='new.aspx'" type="button" value="继续发手机短信">&nbsp;&nbsp;
					<INPUT class="BigButton" onclick="location='send_manage.aspx'" type="button" value="返回">
				</DIV>
			</asp:Panel>
		</form>
	</body>
</HTML>
